add hook to automatically use ipython3 lexer on examples#59984
add hook to automatically use ipython3 lexer on examples#59984Aydin-ab wants to merge 4 commits intoray-project:masterfrom
Conversation
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a Sphinx hook to automatically set the ipython3 lexer for specified notebook files. This is a great solution to prevent build failures caused by unsupported syntax in notebooks, like shell commands. The implementation is clean and correctly uses Sphinx's event system. I have a couple of suggestions to improve the code's robustness: one regarding more specific exception handling and another about adhering to file formatting conventions.
|
cc @aslonnie |
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
doc/source/data/examples/unstructured_data_ingestion/content/unstructured_data_ingestion.ipynb
Outdated
Show resolved
Hide resolved
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
|
This pull request has been automatically closed because there has been no more activity in the 14 days Please feel free to reopen or open a new pull request if you'd still like this to be addressed. Again, you can always ask for help on our discussion forum or Ray's public slack channel. Thanks again for your contribution! |
Issue
python3lexer on the entire notebook unless the writer specifically set one in the notebook metadata (which frankly never happens)python3lexer can not handle cells that starts with!such as!pip install ...or other command cells.ipython3that wraps aroundpython3and is able to parse command cellsIdeally, sphinx should be able to pick a lexer for each cell but it only supports notebook-level lexer
Solution
This PR automatically adds a
ipython3lexer to any notebook listed in any of the glob patterns inipython3_lexer_patterns. For more precision, they can also exclude files with other glob patterns inipython3_lexer_exclude_patterns. This ensures:exclude_patternsfor example)